public class Date {   //创造类 和类名
    public int year;
    public int month;
    public int day;

    public void setDate(int y,int m,int d){
       this.year=y;  //this表示当前对象
        this.month=m;
        this.day=d;
    }

    public void printDate(){
        System.out.println(this.year+"年"+this.month+"月"+this.day+"日");//在代码中习惯使用this
    }

    public static void main(String[] args) {
        Date date=new Date();   //实例化对象
         date.setDate(2024,2,28);
         date.printDate();
        System.out.println("=======");
        Date date2=new Date();
        date2.setDate(2005,3,5);
        date2.printDate();
    }
}
